import pymongo

myclient = pymongo.MongoClient("mongodb://root:root@localhost:27017/")
mydb = myclient["mymongo"]

dblist = myclient.list_database_names()
collist = mydb.list_collection_names()

if __name__ == '__main__':
    mycol = mydb["mylist"]
    mylist = [
        {"name": "Taobao", "alexa": "100", "url": "https://www.taobao.com"},
        {"name": "QQ", "alexa": "101", "url": "https://www.qq.com"},
        {"name": "Facebook", "alexa": "10", "url": "https://www.facebook.com"},
        {"name": "知乎", "alexa": "103", "url": "https://www.zhihu.com"},
        {"name": "Github", "alexa": "109", "url": "https://www.github.com"}
    ]
    result = mycol.insert_many(mylist)
    print(result.inserted_ids)
